package api

import (
	"2212b/happy_orange/api/handler"
	"2212b/happy_orange/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func LoadRouters(r *gin.Engine) {
	api := r.Group("api")
	{
		user := api.Group("user")
		{
			user.POST("/login", handler.Login)
			user.Use(jwt.JWTAuth(consts.JWT_KEY))
			user.GET("/list", handler.GetUserList)
		}
		friend := api.Group("/friend")
		{
			friend.Use(jwt.JWTAuth(consts.JWT_KEY))
			friend.POST("/add", handler.AddFriend)
			friend.POST("/reply", handler.ReplyFriend)
			friend.POST("/remove", handler.RemoveFriend)
		}
	}
}
